package com.econ.powercloud.ems.common.enums;

public enum CalculationDataMatchTypeTagEnum implements EnumMethod{

    TOTAL_POWER("totalPower","总有功功率",2),

    ON_GRID_ENERGY("onGridEnergy","上网电量",2),
    OFF_GRID_ENERGY("offGridEnergy","下网电量",2),
    CHARGE_NUM("chargeNum","充电次数",0),
    DISCHARGE_NUM("disChargeNum","放电次数",0),
    CHARGE_TIME("chargeTime","充电时长",2),
    DISCHARGE_TIME("disChargeTime","放电时长",2),
    DOD("DOD","充放电深度",2),
    ;

    private String code;
    private String desc;
    /**
     * 保留小数
     */
    private Integer decimalNumber;

    public Integer getDecimalNumber() {
        return decimalNumber;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    CalculationDataMatchTypeTagEnum(String code, String desc, Integer decimalNumber){
        this.code=code;
        this.desc=desc;
        this.decimalNumber=decimalNumber;
    }

    public static String getCodeFromCode(String code){
        for(CalculationDataMatchTypeTagEnum type: CalculationDataMatchTypeTagEnum.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }
}
